<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>

<div id="div1">

    <div >
        <span>数字1</span>
        <span>
            <input v-model="number1" type="text" />
        </span>
    </div>

    <div >
        <span>数字2</span>
        <span>
            <input v-model="number2" type="text" />
        </span>
    </div>

    <div>
        <button @click='handle'>计算结果</button>
    </div>

    <div >
        <span>结果</span>
        <span>
            <input v-model="sum" type="text" />
        </span>

    </div>



</div>

<script>

    const vueObj = new Vue({
        el:'#div1',
        data: {
            number1: '',
            number2: '',
            sum: ''

        },
        methods:{
            handle:function(event){
                this.sum = parseInt(this.number1) + parseInt(this.number2);

            },

        }
    });
</script>
</body>
</html>